home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Celestin Apprentice 5
/
Apprentice-Release5.iso
/
Source Code
/
C++
/
Applications
/
NeuroSim 1.0
/
.cp
/
CStdNeuralNet.cp
< prev
next >
Wrap
Text File
|
1996-02-19
|
2KB
|
53 lines
// ===========================================================================
// CStdNeuralNet.cp ©1996 Timo Eloranta
// ===========================================================================
// A concrete neural net class derived from the abstract CNeuralNet class
#include "CStdNeuralNet.h"
#include "CStdNeuron.h"
// ---------------------------------------------------------------------------
// • CStdNeuralNet
//
// Called by: CNeuroSimApp::InitNewNet
// ---------------------------------------------------------------------------
// Constructor. Note that the constructor of the abstract base class
// (CNeuralNet) must be called before creating and initializing the matrix.
CStdNeuralNet::CStdNeuralNet(
const SGenParams &inParams )
: CNeuralNet( inParams.size )
{
CreateMatrix();
InitMatrix( inParams );
}
// ---------------------------------------------------------------------------
// • ~CStdNeuralNet
// ---------------------------------------------------------------------------
// Destructor. Junk the matrix if it exists.
CStdNeuralNet::~CStdNeuralNet()
{
if ( mMatrix ) {
delete [] mMatrix;
mMatrix = NULL;
}
}
// ---------------------------------------------------------------------------
// • CreateMatrix
//
// Called by: CStdNeuralNet::CStdNeuralNet
// ---------------------------------------------------------------------------
// Create the matrix as an array of neurons (of type CStdNeuron).
void
CStdNeuralNet::CreateMatrix()
{
if ( mMatrix )
delete [] mMatrix;
mMatrix = new CStdNeuron[ mSize * mSize ];
}